layui.use(['form' , 'layer' , 'jquery'] , function (data){
    var form = layui.form ,
        layer = layui.layer,
        $ = layui.jquery;

    // 加载下拉框
    $.ajax({
        type: "get",
        url: ctx + "/emp/selectDesignerEmpByRoleInRoleName?roleName=" + "quality",
        data: {},
        success: function (data) {
            console.log(data)
            var opt;
            if (data != null) {
                for (var i = 0; i < data.length; i++) {
                    opt = "<option value='" + data[i].id + "'  >" + data[i].name + "</option>";
                    $("#qualityerId").append(opt);
                }
                form.render("select")
            }
        }
    });
    //提交
    form.on('submit(addEmpToQualityFilter)', function (data) {
        var formData = data.field;
        $.ajax({
            data: formData,
            url: ctx + "/quality/addEmpToProduceQuality",
            type: "post",
            success: function (data) {
                if (data.code == 200) {
                    layer.msg(data.msg, {icon: 5})
                    layer.closeAll("iframe");
                    parent.location.reload();
                } else {
                    layer.msg(data.msg)
                    layer.closeAll("iframe");

                }
            }, error: function (data) {
                layer.msg("error");
                layer.closeAll("iframe");
            }
        })
        return false;
    })










})